strs = ["flower", "flow", "flight"]

l = len(strs)
# 得到字符串的长度

if strs == [""] or strs == []:
    print("")
if len(strs) == 1:
    print("".join(strs))


def judge(str1, str2):
    "判断两个字符串的重复前缀，并返回重复的字符串"
    str1 = list(str1)
    str2 = list(str2)
    result = []

    # 判断长度最小的那个字符串
    if len(str1) <= len(str2):
        min = str1
    else:
        min = str2

    for i in range(len(min)):
        if str1[i] == str2[i]:
            result.append(str1[i])
        else:
            break

    return result


j = 2
result = judge(strs[0], strs[1])
for i in range(l - 2):  # 总共只需要比较l-1次就可以了
    result = judge(result, strs[j])
    j = j + 1
if result == []:
    print("")
result = "".join(result)
print(result)
